<?php

 $h = fopen("/tmp/abc.txt", "w");
 //$name = $_REQUEST['email];
 //fwrite($h, "company name =".$name);
 
$uploaddir = '/home/zwu/app/re-eng/files/'; 
$file = $uploaddir . basename($_FILES['uploadfile']['name']); 
$size=$_FILES['uploadfile']['size'];
$tempFile  = $_FILES['uploadfile']['tmp_name'];
fwrite($h, "filename =". $tempFile."\n");
if($size>1024*1024*20)
{
        fwrite($h, "failed");
        fclose($h);
	echo "error file size > 20 MB";
	unlink($_FILES['uploadfile']['tmp_name']);
	exit;
}
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) { 
  echo "success"; 
  fwrite($h, "Good");
} else {
	$error = "error ".$_FILES['uploadfile']['error']." --- ".$_FILES['uploadfile']['tmp_name']." %%% ".$file."($size)";
   fwrite($h, "\n".$error."\n");
}
fwrite($h, "abc");
fwrite($h, $_REQUEST['email']);
fclose($h);
?>
